/*
 * Copyright (C) 2011 Dirk Weißenborn, dirk.weissenborn@gmail.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.weissenborn.colabtex.client.places;

import com.google.gwt.place.shared.Place;
import com.google.gwt.place.shared.PlaceTokenizer;

/**
 * The Class Login is the place which corresponds to the login activity
 */
public class Login extends Place {

	/** The desired place to go after successful login */
	Place desiredPlace;
	
	/**
	 * Sets the desired place.
	 *
	 * @param desiredPlace the new desired place
	 */
	public void setDesiredPlace(Place desiredPlace) {
		this.desiredPlace = desiredPlace;
	}

	/**
	 * Gets the desired place.
	 *
	 * @return the desired place
	 */
	public Place getDesiredPlace() {
		return desiredPlace;
	}

	/**
	 * Instantiates a new login.
	 *
	 * @param desiredPlace the desired place
	 */
	public Login(Place desiredPlace) {
		this.desiredPlace = desiredPlace;
	}
	
	/**
	 * The Class Tokenizer.
	 */
	public static class Tokenizer implements PlaceTokenizer<Login> {

		/* (non-Javadoc)
		 * @see com.google.gwt.place.shared.PlaceTokenizer#getToken(com.google.gwt.place.shared.Place)
		 */
		public String getToken(Login place) {
			return "";
		}

		/* (non-Javadoc)
		 * @see com.google.gwt.place.shared.PlaceTokenizer#getPlace(java.lang.String)
		 */
		public Login getPlace(String token) {
			return new Login(new Dashboard());
		}

	}
}
